/**
 * Created by JetBrains WebStorm.
 * User: Silence
 * Date: 3/18/12
 * Time: 9:06 AM
 * To change this template use File | Settings | File Templates.
 */
Ext.require('Ext.window.*');

Ext.define('EM.view.event.EventWindowView', {
    extend: 'Ext.window.Window',
    id: 'eventwindow',
    alias: 'widget.eventwindow',
    title: 'Planning Event',
    width: '700',
    height: '600',
    layout: 'card',
    activeItem: 0,
    autoShow: true,
    closeAction: 'hide',
    iconCls: 'icon-event',
    modal: 'true',
    closable: 'true',
    listeners: {
        hide: function() {
            Ext.getCmp('downloadallbutton').hide();
            Ext.getCmp('downloadspecificbutton').hide();
        }
    },
    initComponent: function() {
        Ext.apply(this, {
            dockedItems: [
                {
                    xtype: 'toolbar',
                    id: 'eventtoolbar',
                    height: 28,
                    dock: 'top',
                    items: [
                        { xtype: 'button', id: 'eventbasic', enableToggle: true, text: 'Basic', toggleGroup: 'eventinfo', action: 'changepanel'}, '-',
                        { xtype: 'splitbutton', id: 'eventpeople', enableToggle: true, text: 'All', toggleGroup: 'eventinfo', action: 'changepanel',
                            menu: new Ext.menu.Menu({
                                id: 'peoplemenu',
                                items: [ {text: 'All'}, { text: 'Participant'}, { text: 'Organizer'}, { text: 'Sponsor'} ]
                            })
                        }, '-',
                        { xtype: 'button', id: 'eventbudget', enableToggle: true, text: 'Budget', toggleGroup: 'eventinfo', action: 'changepanel'}, '-',
                        { xtype: 'tbspacer', width: 400 },
                        { xtype: 'button', id: 'eventdelete', text: 'Delete' }
                    ]
                }
            ],
            items: [
                { xtype: 'eventbasicview', id: 'eventbasicview'},
                { xtype: 'eventpeopleview', id: 'eventpeopleview'},
                { xtype: 'eventbudgetview', id: 'eventbudgetview'}
            ]
        });
        this.callParent(arguments);
    },
    showWithData: function(button) {
        this.setTitle('Planning Event {' + button.getId() + '}');
        this.show();
        Ext.getCmp('downloadallbutton').show();
        Ext.getCmp('downloadspecificbutton').show();
        Ext.getCmp('eventpeopleview').updateActiveEvent(button);
    }
});